﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Model.Sec
{
    public class NodeCollection : IListSource
    {
        private Node[] _nodes;
        private int _Count;

        bool IListSource.ContainsListCollection
        {
            get { return false; }
        }
        System.Collections.IList IListSource.GetList()
        {
            BindingList<Node> ble = new BindingList<Node>();


            foreach (Node node in _nodes)
            {
                ble.Add(node);
            }


            return ble;
        }



        /// <summary>
        /// 单元集合的构造函数
        /// </summary>
        /// <param name="Length">长度</param>
        public NodeCollection(int Count)
        {
            this._Count = Count;
            _nodes = new Node[this._Count];
        }
        /// <summary>
        /// 集合的长度
        /// </summary>
        public int Count
        {
            get { return this._nodes.Length; }
        }
        /// <summary>
        /// 读取或设置索引为index的Unit对象
        /// </summary>
        /// <param name="index">索引值</param>
        /// <returns>Unit对象</returns>
        public Node this[int index]
        {
            get
            {
                return _nodes[index];
            }
            set
            {
                _nodes[index] = value;
            }
        }
        public Node[] nodes
        {
            get { return this._nodes; }
        }


    }
}